import 'package:flutter/material.dart';
import 'package:flutter_wechat/core/routes/routes.dart';
import 'package:flutter_wechat/pages/contacts/contacts.dart';
import 'package:flutter_wechat/pages/contacts/contactsBinding.dart';
import 'package:flutter_wechat/pages/discover/discover.dart';
import 'package:flutter_wechat/pages/discover/discoverBinding.dart';
import 'package:flutter_wechat/pages/home/home.dart';
import 'package:flutter_wechat/pages/home/homeBinding.dart';
import 'package:flutter_wechat/pages/me/me.dart';
import 'package:flutter_wechat/pages/me/meBinding.dart';
import 'package:get/get.dart';

class InitialController extends GetxController {
  var bottomNavigationBarIndex = 0.obs;

  List<Widget> pages = [
    GetNavigator(
      key: Get.nestedKey(Routes.HOME),
      pages: [
        GetPage(
          name: Routes.HOME,
          binding: HomeBinding(),
          page: () {
            return HomePage();
          },
        ),
      ],
    ),
    GetNavigator(
      key: Get.nestedKey(Routes.CONTACTS),
      pages: [
        GetPage(
          name: Routes.CONTACTS,
          binding: ContactsBinding(),
          page: () {
            return ContactsPage();
          },
        ),
      ],
    ),
    GetNavigator(
      key: Get.nestedKey(Routes.DISCOVER),
      pages: [
        GetPage(
          name: Routes.DISCOVER,
          binding: DiscoverBinding(),
          page: () {
            return DiscoverPage();
          },
        ),
      ],
    ),
    GetNavigator(
      key: Get.nestedKey(Routes.ME),
      pages: [
        GetPage(
          name: Routes.ME,
          binding: MeBinding(),
          page: () {
            return MePage();
          },
        ),
      ],
    )
  ];

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
  }

  changeIndex(index) {
    bottomNavigationBarIndex.value = index;
    update(["g-body-pages", "g-nav-bottoms"]);
  }
}
